2007-07-23 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtktooltip.c (gtk_tooltip_set_custom): Protect against
+ recursion via gtk_container_remove(). (#459561, Christian Persch)
+ (gtk_tooltip_window_hide): Simplify.
+
* tests/testtooltips.c: Add code to test gtk_tooltip_set_custom()
2007-07-23 Christian Persch <chpe@gnome.org>
if (tooltip->custom_widget)
{
- gtk_container_remove (GTK_CONTAINER (tooltip->box),
- tooltip->custom_widget);
- g_object_unref (tooltip->custom_widget);
+ GtkWidget *custom = tooltip->custom_widget;
+ /* Note: We must reset tooltip->custom_widget first,
+ * since gtk_container_remove() will recurse into
+ * gtk_tooltip_set_custom()
+ */
+ tooltip->custom_widget = NULL;
+ gtk_container_remove (GTK_CONTAINER (tooltip->box), custom);
+ g_object_unref (custom);
}
if (custom_widget)
gtk_container_add (GTK_CONTAINER (tooltip->box), custom_widget);
gtk_widget_show (custom_widget);
}
- else
- tooltip->custom_widget = NULL;
}
/**
{
GtkTooltip *tooltip = GTK_TOOLTIP (user_data);
- if (tooltip->custom_widget)
- gtk_tooltip_set_custom (tooltip, NULL);
+ gtk_tooltip_set_custom (tooltip, NULL);
}
/* event handling, etc */